<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<title>个人信息</title>
		<%@include file="/WEB-INF/base.jspf"%>
		<style type="text/css">
			input, btn.btn-class-closeFakeModal{margin-top: 40px;}
			.col-xs-12 *{font-size: 15px;font-weight: bold;}
			li{height: 60px;line-height: 60px;border-top: 1px solid #f2f2f2;}
		</style>
	</head>

	<body>
		<div class="col-xs-12 col-sm-4 col-sm-offset-4 text-center bg-theme" style="height: 50px;line-height:50px;position: fixed;margin-top: 0px;left: 0px;z-index: 100;">
			<a onclick="back()" class="glyphicon glyphicon-chevron-left" style="cursor:pointer;color: white;font-size: 20px;position: absolute;top:50%;left:10px;transform:translateY(-50%);"></a>
			<strong style="font-size: 20px;color: white;">修改资料</strong>
		</div>
		<div class="col-xs-12 col-sm-4 col-sm-offset-4 text-center" >
			<div style="height: 50px;" class="br"></div>
			<input id="pass" type="password" placeholder="请输入原来密码" class="form-control input-lg"  />
			<input id="npass1" type="password" placeholder="新密码" class="form-control input-lg"/>
			<input id="npass2" type="password" placeholder="再次输入新密码" class="form-control input-lg" />
			<input id="submit" type="submit" class="form-control input-lg btn btn-primary" style="background: ;color: balck;font-size: 20px;" value="确认修改"/>
		</div>
<div class="modal-div-fakeModal" id="div-i-noticeGenDan">
	<div class="div-c-modalContent">
		<h3 class="fakemodal-title"></h3>
		<div class="fakemodal-content"></div>
		<div class="fakemodal-btnsGroup"><button class="btn btn-default btn-class-closeFakeModal">关闭</button></div>
	</div>
</div>			
	</body>
	<script type="text/javascript">
		$(function(){
			$("#submit").click(function(){
				if ("${user.state}" === "2") {
					showNormalNoticeModal("#div-i-noticeGenDan", "提示：", "试玩账号无法修改密码，请注册正式账号")
					return
				}
				if(!$("#pass").val().trim()){
					showNormalNoticeModal("#div-i-noticeGenDan", "提示：", "旧密码不能为空")
					return false;
					}
				if(!checkPassWord($("#npass1").val())){
					showNormalNoticeModal("#div-i-noticeGenDan", "提示：", "密码必须由字母数字组成，大于6位且小于16位")
					return false;
					}
				if($("#npass1").val()!=$("#npass2").val()){
					showNormalNoticeModal("#div-i-noticeGenDan", "提示：", "两次密码输入不一致")
					return false;}
				ajax({
					url:'/u/changePass.do',
					type:'post',
					data:{pass:$("#pass").val(),npass:$("#npass1").val()},
					success:function(data){
						var json=eval('('+data+')');
						showNormalNoticeModal("#div-i-noticeGenDan", "提示：", json.data)
						if(json.message){
							setTimeout(function() {
								location.reload();
							}, 1000)
							}
					}
					
				});
			});
		});
	</script>
</html>